/**
 * 
 */
package com.base.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author leiruiqi
 *
 */
public class MyExceptionHandler implements HandlerExceptionResolver {
	
	@SuppressWarnings("unused")
	private static final Logger logger = LoggerFactory.getLogger(MyExceptionHandler.class);

	private String exceptionPage;

	@Override
	public ModelAndView resolveException(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex) {
		logger.error("", ex);
		ModelAndView view =  new ModelAndView("/test/exception"); 
		view.addObject("err", ex);
		return view;
	}

	public String getExceptionPage() {
		return exceptionPage;
	}

	public void setExceptionPage(String exceptionPage) {
		this.exceptionPage = exceptionPage;
	}

	
	
	
}
